package com.ss.android.lockscreen;

import android.content.Context;
import android.net.Uri;
import android.text.TextUtils;
import android.widget.ImageView;


import com.squareup.picasso.Picasso;
import com.squareup.picasso.RequestCreator;
import com.squareup.picasso.Callback;
import com.ss.android.article.base.app.AppData;
import com.ss.android.article.browser.lockscreen.b;
import com.ss.android.browser.base.wrapper.a.BrowserSharedPreferencesWrapper;
import com.ss.android.common.app.AbsApplication;
import com.ss.android.common.util.NetworkUtils;

import java.util.Date;

public class e {
    private static e a;

    public e() {

    }

    public static e a() {
        if (e.a == null) {
            Class v1 = e.class;
            synchronized (v1) {
                if (e.a == null) {
                    e.a = new e();
                }
            }
        }

        return e.a;
    }

    public static void a(Context arg1) {
        com.ss.android.lockscreen.bb.a().a(arg1);
    }

    public static void a(boolean arg3) {
        com.ss.android.lockscreen.bb v0 = com.ss.android.lockscreen.bb.a();
        if (v0.a == null) {
            throw new RuntimeException("mContext is null");
        }

        android.support.design.a.B.a.a("lock_screen_app_setting", arg3);
        v0.b();
    }

    public static boolean b() {
        boolean v0 = !android.support.design.a.B.a() || !android.support.design.a.B.b() || !com.ss.android.lockscreen.c.b.a.a().a() ? false : true;
        return v0;
    }

    public static boolean c() {
        com.ss.android.lockscreen.bb.a();
        return com.ss.android.lockscreen.bb.d();
    }

    public static void d() {
        com.ss.android.lockscreen.bb.a().g = false;
    }

    public static final class a {
        public a() {

        }

        public static boolean a() {
            boolean v0 = false;
            if (AppData.getInstance().getAbSettings().isRelatedNewsJumpToTT()) {
                try {
                    String v1_1 = BrowserSharedPreferencesWrapper.getString("down_tmp_apk", "");
                    long v2 = BrowserSharedPreferencesWrapper.getLong("last_time_try_install_tt");
                    if (!com.ss.android.article.browser.download.b.a.a(v1_1)) {
                        return v0;
                    }

                    long v4 = new Date().getTime();
                    if (v4 >= v2 && v4 - v2 <= 21600000) {
                        return v0;
                    }

                    BrowserSharedPreferencesWrapper.putLong("last_time_try_install_tt", v4);
                    b.a(AbsApplication.getApplication(), v1_1);
                    v0 = true;
                } catch (Throwable v1) {
                }
            }

            return v0;
        }
    }

    public static final class e$b {
        public e$b() {

        }
    }

    public static final class e$c {
        public e$c() {

        }

        public static String a(String arg3, byte[] arg4, String arg5) {
            String v0 = null;
            if (!TextUtils.isEmpty(((CharSequence) arg3))) {
                int v1 = 8192;
                NetworkUtils.CompressType v2 = null;
                try {
                    v0 = NetworkUtils.executePost(v1, arg3, arg4, v2, arg5);
                } catch (Exception v1_1) {
                    v1_1.printStackTrace();
                }
            }

            return v0;
        }

        public static String a(String arg2) {
            String v0 = null;
            if (!TextUtils.isEmpty(arg2)) {
                int v1 = -1;
                try {
                    v0 = NetworkUtils.doGet(v1, arg2);
                } catch (Exception v1_1) {
                    v1_1.printStackTrace();
                }
            }

            return v0;
        }
    }

    public static final class d {
        public d() {

        }

        public static void a(Context arg3, ImageView arg4, String arg5) {
            RequestCreator v0;
            Uri v2 = null;
            Picasso v1 = Picasso.with(arg3);
            if (arg5 == null) {
                v0 = new RequestCreator(v1, v2);
            } else if (arg5.trim().length() == 0) {
                throw new IllegalArgumentException("Path must not be empty.");
            } else {
                v0 = v1.load(Uri.parse(arg5));
            }

            v0.into(arg4, ((Callback) v2));
        }
    }

    public static final class e$e {
        public e$e() {

        }
    }
}

